// Impl

// Local
#include "simphysicsobject.h"
#include "simutils.h"


// Qt
#include <QOpenGLBuffer>
#include <QOpenGLVertexArrayObject>
#include <QMatrix4x4>



SimPhysicsObject::SimPhysicsObject(ObjectType type) :
    mType(type)
{
    mVAO = new QOpenGLVertexArrayObject();
    mVAO->create();

    mVBO = new QOpenGLBuffer(QOpenGLBuffer::VertexBuffer);
    mVBO->create();

    mIBO = new QOpenGLBuffer(QOpenGLBuffer::IndexBuffer);
    mIBO->create();

    // Create and populate the vertices etc
    createGeometry();

    // Create and populate the vertices etc
    createPhysics();

}

SimPhysicsObject::~SimPhysicsObject()
{
    delete mIBO;
    delete mVBO;

    // as its NOT parented to this object - cant be as this is not a QObject
    delete mVAO;
}

void
SimPhysicsObject::createGeometry()
{
    // TODO call upon SimShapeGenerator


}

void
SimPhysicsObject::createPhysics()
{
    // TODO call upon Bullet

}

void
SimPhysicsObject::render()
{
    qDebug() << "SimPhysicsObject::render: TODO";
}
